package com.bensonbasement.snorflux.client.states;

import java.awt.event.KeyEvent;

import com.bensonbasement.snorflux.client.SnorfluxClient;
import com.bensonbasement.snorflux.client.SnorfluxClient.ClientState;
import com.bensonbasement.snorflux.messages.fromserver.JoinedMessage;
import com.bensonbasement.snorflux.messages.fromserver.ServerTimeMessage;
import com.bensonbasement.snorflux.messages.fromserver.WorldTimeMessage;

public class DisconnectedState extends ClientState {

	public DisconnectedState(SnorfluxClient client) {
		super(client);
	}
	
	@Override
	public void initialize() {
		super.initialize();	
		getChatPanel().setEnabled(false);
	}
	
	@Override
	public void keyPressed(KeyEvent e) {}
	
	@Override
	public void keyReleased(KeyEvent e) {}
	
	@Override
	public void keyTyped(KeyEvent e) {}
	
	@Override
	public void handleTextEntered(String text) {
		throw new RuntimeException("Text cannot be entered when disconnected.");
	}
	
	@Override
	public void handleTextCanceled() {
		throw new RuntimeException("Text cannot be canceled when disconnected.");
	}
	
	@Override
	public void handleConnected(JoinedMessage message) {
		throw new RuntimeException("Should not be able to connect when in this state.");
	}
	
	@Override
	public synchronized void handleDisconnected() {
		throw new RuntimeException("Cannot disconnect when already disconnected.");
	}
	
	@Override
	public void handleServerTimeMessage(ServerTimeMessage message) {
		throw new RuntimeException("Should not receive messages when disconnected.");
	}
	
	@Override
	public void handleWorldTimeMessage(WorldTimeMessage message) {
		throw new RuntimeException("Should not receive messages when disconnected.");
	}
}
